import { createStore, applyMiddleware } from "redux";
import thunk from 'redux-thunk';
// import logger from 'redux-logger'
import reducers from './reducers'
// 持久化引入
import { persistStore, persistReducer } from 'redux-persist'
import storage from 'redux-persist/lib/storage'
import autoMergeLevel2 from "redux-persist/es/stateReconciler/autoMergeLevel2";
import { composeWithDevTools } from "redux-devtools-extension";

const persistConfig = {
    key: 'root',
    storage: storage,
    stateReconciler: autoMergeLevel2//查看‘merge process' 部分的具体情况
}
const myPersistReducer = persistReducer(persistConfig, reducers)
const store = createStore(myPersistReducer, composeWithDevTools(applyMiddleware(thunk)))
export const persistor = persistStore(store)
export default store

// import { createStore, applyMiddleware } from 'redux';
// import reducers from './reducers/index';
// import thunk from 'redux-thunk';
// import logger from 'redux-logger';
// import { persistStore, persistReducer } from 'redux-persist';
// import storage from 'redux-persist/lib/storage';
// import autoMergeLevel2 from 'redux-persist/lib/stateReconciler/autoMergeLevel2';
// import { composeWithDevTools } from 'redux-devtools-extension';
// const persistConfig = {
//     key: 'root',
//     storage: storage,
//     stateReconciler: autoMergeLevel2 // 查看 'Merge Process' 部分的具体情况
// };
// const myPersistReducer = persistReducer(persistConfig, reducers)
// const store = createStore(myPersistReducer, composeWithDevTools(applyMiddleware(thunk, logger)))
// export const persistor = persistStore(store)
// export default store